package com.assets.newNHF.helper;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by WuQuan on 2018/3/29.
 */

public class SPHelper {
    public  static int getSharedValue(Context context){
        SharedPreferences shared = context.getSharedPreferences("power", 0);
        return shared.getInt("value", 26);
    }

    public  static String getSharedPortPath(Context context) {
        SharedPreferences shared = context.getSharedPreferences("portPath", 0);
        return shared.getString("portPath", "/dev/ttyS2");
    }

    public  static void saveSharedPortPath(String portPath, Context context) {
        SharedPreferences shared = context.getSharedPreferences("portPath", 0);
        SharedPreferences.Editor editor = shared.edit();
        editor.putString("portPath", portPath);
        editor.commit();
    }

    public  static void saveSharedValue(int value, Context context){
        SharedPreferences shared = context.getSharedPreferences("power", 0);
        SharedPreferences.Editor editor = shared.edit();
        editor.putInt("value", value);
        editor.commit();
    }
}
